//$URL: http://dasding.googlecode.com/svn/branches/testzeugs/data/data/src/main/java/de/piratech/dasding/data/Location.java $
//$Id: Location.java 89 2012-11-12 14:55:42Z amuthmann@gmail.com $
/*
 * Copyright 2012 Piratech.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package de.piratech.dasding.data;

import de.piratech.dasding.data.database.DataType;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.commons.lang3.StringUtils;
import org.codehaus.jackson.annotate.JsonIgnore;

/**
 * A single location used to define a place where an event/action takes place
 *
 * @author deveth0
 */
@XmlRootElement
public class Location extends AbstractDataObject {

  private Double mLongitude;
  private Double mLatitude;
  private String mName;
  private String mStreet;
  private String mZip;
  private String mCity;

  public Double getLongitude() {
    return mLongitude;
  }

  public void setLongitude(Double pLongitude) {
    this.mLongitude = pLongitude;
  }

  public Double getLatitude() {
    return mLatitude;
  }

  public void setLatitude(Double pLatitude) {
    this.mLatitude = pLatitude;
  }

  public String getName() {
    return mName;
  }

  public void setName(String pName) {
    this.mName = pName;
  }

  public String getStreet() {
    return mStreet;
  }

  public void setStreet(String pStreet) {
    this.mStreet = pStreet;
  }

  public String getZip() {
    return mZip;
  }

  public void setZip(String pZip) {
    this.mZip = pZip;
  }

  public String getCity() {
    return mCity;
  }

  public void setCity(String pCity) {
    this.mCity = pCity;
  }

  @Override
  @JsonIgnore
  public boolean isValid() {
    return StringUtils.isNotBlank(mName)
            && ((mLatitude != null && mLongitude != null)
            || (StringUtils.isNotBlank(mStreet)
            && StringUtils.isNotBlank(mZip)
            && StringUtils.isNotBlank(mCity)));
  }

  @Override
  public DataType getDataType() {
    return null;
  }
}
